package com.cuit.riskassessment.service.impl;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cuit.riskassessment.dao.rm.RmMapper;
import com.cuit.riskassessment.service.RmService;
import com.cuit.riskassessment.vo.RmParam;

@Service(value="rmService")
public class RmServiceImpl implements RmService {

	@Autowired
	@Resource(name="rmMapper")
	private RmMapper rmMapper;
	
	@Override
	public boolean addOrUpdateRu(RmParam rm) {
		// TODO Auto-generated method stub
		boolean flag = false;
		if(rmMapper.isRmExist(rm.getProjid())==null)
		{
			flag = this.rmMapper.addRm(rm)>0?true:false;
		}else
		{
			flag = this.rmMapper.updateRm(rm)>0?true:false;
		}
		return flag;
	}

	@Override
	public RmParam getRm(Integer projid) {
		// TODO Auto-generated method stub
		return this.rmMapper.getRm(projid);
	}

}
